<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2023/3/30
 * Time: 10:21
 */

namespace App\Rep;


use App\Models\OrderAudit;
use App\Models\OrderAuditLog;

class SystemSetupRep
{

    /**
     * 获取订单审核设置列表
     * @param $params
     * @return mixed
     */
    public function getOrderAuditListRep($params){
        $list = OrderAudit::Search($params)->orderBy('sort','desc')->paginate($params['per_page']??100);
        return $list;
    }

    /**
     * 设置订单审核状态
     * @param $params
     */
    public function setOrderAuditStatusRep($params){
        $model = OrderAudit::where('id',$params['id'])->first();
        $model->status = $params['status'];
        $model->save();
        OrderAuditLog::where('order_audit_id',$params['id'])->update(['status'=>$params['status']]);
        return $model;
    }




}